﻿@using System.Configuration
@using MVCMongo.Services
@model IEnumerable<DataMongo.Entities.FeedPost>
@{
    ViewBag.Title = "AllFeeds";
    int leftcolumnCount = 0;
    int rightcolumnCount = 0;
    var configUrl = ConfigurationManager.AppSettings["ImageLinkUrl"];
}

<div class="wrapper">

    <div class="main-content">
        <!-- BEGIN .main-page -->
        <div class="main-page left">
            <!-- BEGIN .double-block -->
            <div class="double-block">

                <!-- BEGIN .content-block -->
                <div class="content-block main right">

                    <div class="block">
                        <div class="block-title">
                            <a href="category.html" class="right"></a>
                            <h2>All Feeds</h2>
                        </div>
                        <div class="block-content">

                            <div class="paragraph-row">
                                @{
                                    int remainder =(Model.Count() % 2);
                                    if (remainder > 0)
                                    {
                                       leftcolumnCount= Convert.ToInt32(Model.Count()/2) + 1;
                                    }
                                    else
                                    {
                                        leftcolumnCount = Convert.ToInt32(Model.Count()/2);
                                    }
                                }
                                <!-- BEGIN .column6 -->
                                <div class="column6">
                                    <ul class="article-block">
                                        @foreach (var item in Model.OrderByDescending(x=>x.FeedPostId).Take(leftcolumnCount))
                                        {
                                            var imageUrl = configUrl + item.ImageURL1;
                                            <li>
                                                <div class="article-photo">
                                                    <a href="@Url.RouteUrl("ViewFeed", new { id = item.FeedPostId, title = UtilityService.RemoveSpecialCharacters(item.Title) })" class="hover-effect" target="_blank"><img src="@imageUrl" width="59px" height="42px" alt="" /></a>
                                                </div>
                                                <div class="article-content">
                                                    <h4><a href="@Url.RouteUrl("ViewFeed", new { id = item.FeedPostId, title = UtilityService.RemoveSpecialCharacters(item.Title) })" target="_blank">@item.Title</a><a class="h-comment" href="@Url.Action("FeedComment", "Home", new { feedId = item.FeedPostId})">@UtilityService.GetCommentCount(item.FeedPostId)</a></h4>
                                                    <span class="meta">
                                                        <a href="blog.html"><span class="icon-text">&#128340;</span>@item.PublishDate.Substring(0, 16)</a>
                                                    </span>
                                                </div>
                                            </li>
                                        }
                                    </ul>
                                    <!-- END .column6 -->
                                </div>

                                <!-- BEGIN .column6 -->
                                @{
                                    rightcolumnCount = Model.Count() - leftcolumnCount;
                                }
                                <div class="column6">
                                    <ul class="article-block">
                                       @foreach (var item in Model.OrderBy(x => x.FeedPostId).Take(rightcolumnCount))
                                       {
                                           var imageUrl = configUrl + item.ImageURL1;
                                            <li>
                                                <div class="article-photo">
                                                    <a href="@Url.RouteUrl("ViewFeed", new { id = item.FeedPostId, title = UtilityService.RemoveSpecialCharacters(item.Title) })" class="hover-effect" target="_blank"><img src="@imageUrl" width="59px" height="42px" alt="" /></a>
                                                </div>
                                                <div class="article-content">
                                                    <h4><a href="@Url.RouteUrl("ViewFeed", new { id = item.FeedPostId, title = UtilityService.RemoveSpecialCharacters(item.Title) })" target="_blank">@item.Title</a><a class="h-comment" href="@Url.Action("FeedComment", "Home", new { feedId = item.FeedPostId})">@UtilityService.GetCommentCount(item.FeedPostId)</a></h4>
                                                    <span class="meta">
                                                        <a href="blog.html"><span class="icon-text">&#128340;</span>@item.PublishDate.Substring(0, 16)</a>
                                                    </span>
                                                </div>
                                            </li>
                                        }

                                    </ul>
                                    <!-- END .column6 -->
                                </div>
                            </div>
                        </div>
                    </div>


                    <div class="block">
                        <div class="banner">
                            <a href="#" target="_blank"><img src="../../images/no-banner-468x60.jpg" alt="" /></a>
                            <a href="comments.html" class="ad-link"><span class="icon-text">&#9652;</span>Advertisement<span class="icon-text">&#9652;</span></a>
                        </div>
                    </div>

                    @*<div class="block">
                        <div class="block-title" style="background: #dd8229;">
                            <a href="category.html" class="right">View all travel news</a>
                            <h2>Blog of Users</h2>
                        </div>
                        <div class="block-content">
                            <ul class="article-block-big">
                                <li>
                                    <div class="article-photo">
                                        <a href="post.html" class="hover-effect"><img src="../../images/photos/image-10.jpg" alt="" /></a>
                                    </div>
                                    <div class="article-content">
                                        <h4><a href="post.html">Debitis minimum vituperata mei no adipiscing</a><a href="post.html#comments" class="h-comment">201</a></h4>
                                        <span class="meta">
                                            <a href="blog.html"><span class="icon-text">&#128340;</span>11:20, 7.Oct 2013</a>
                                        </span>
                                    </div>
                                </li>
                                <li>
                                    <div class="article-photo">
                                        <a href="post.html" class="hover-effect"><img src="../../images/photos/image-11.jpg" alt="" /></a>
                                    </div>
                                    <div class="article-content">
                                        <h4><a href="post.html">Nec option veritus ullamcorper quaestio</a><a href="post.html#comments" class="h-comment">74</a></h4>
                                        <span class="meta">
                                            <a href="blog.html"><span class="icon-text">&#128340;</span>11:20, 7.Oct 2013</a>
                                            <span class="tag" style="background: #2a8ece;">Custom Tag</span>
                                        </span>
                                    </div>
                                </li>
                                <li>
                                    <div class="article-photo">
                                        <a href="post.html" class="hover-effect"><img src="../../images/photos/image-12.jpg" alt="" /></a>
                                    </div>
                                    <div class="article-content">
                                        <h4><a href="post.html">Ea fugit appareat quaestio delectus pericula</a><a href="post.html#comments" class="h-comment">39</a></h4>
                                        <span class="meta">
                                            <a href="blog.html"><span class="icon-text">&#128340;</span>11:20, 7.Oct 2013</a>
                                        </span>
                                    </div>
                                </li>
                                <li>
                                    <div class="article-photo">
                                        <a href="post.html" class="hover-effect"><img src="../../images/photos/image-13.jpg" alt="" /></a>
                                    </div>
                                    <div class="article-content">
                                        <h4><a href="post.html">Ex cibo ullum nostrum per quo cu utamur fabulas</a><a href="post.html#comments" class="h-comment">99</a></h4>
                                        <span class="meta">
                                            <a href="blog.html"><span class="icon-text">&#128340;</span>11:20, 7.Oct 2013</a>
                                        </span>
                                    </div>
                                </li>
                                <li>
                                    <div class="article-photo">
                                        <a href="post.html" class="hover-effect"><img src="../../images/photos/image-14.jpg" alt="" /></a>
                                    </div>
                                    <div class="article-content">
                                        <h4><a href="post.html">Debitis minimum vituperata mei no intellegam</a><a href="post.html#comments" class="h-comment">201</a></h4>
                                        <span class="meta">
                                            <a href="blog.html"><span class="icon-text">&#128340;</span>11:20, 7.Oct 2013</a>
                                        </span>
                                    </div>
                                </li>
                                <li>
                                    <div class="article-photo">
                                        <a href="post.html" class="hover-effect"><img src="../../images/photos/image-15.jpg" alt="" /></a>
                                    </div>
                                    <div class="article-content">
                                        <h4><a href="post.html">Debitis minimum vituperata mei no intellegam</a><a href="post.html#comments" class="h-comment">201</a></h4>
                                        <span class="meta">
                                            <a href="blog.html"><span class="icon-text">&#128340;</span>11:20, 7.Oct 2013</a>
                                        </span>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>*@
                    <!-- END .content-block -->
                </div>

                <!-- BEGIN .content-block -->
                <div class="content-block left">

                </div>
                <!-- END .double-block -->
            </div>
            <!-- END .main-page -->
        </div>

        <!-- BEGIN .main-sidebar -->
        <div class="main-sidebar right">




        </div>
        <div class="clear-float"></div>
    </div>

    <!-- END .wrapper -->
</div>
